﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.Net.Mail;

namespace DongDong.Common
{
    /// <summary>
    /// Summary description for Email
    /// </summary>

    public class Email
    {
        public Email()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public void SendEmail(string objSend, string InnerText)
        {


            MailMessage message = new MailMessage();
            message.From = new MailAddress("server@dooguo.com", "逗果科技管理中心");
            for (int i = 0; i < objSend.Split(';').Length; i++)
            {
                if (string.IsNullOrEmpty(objSend.Split(';')[i]))
                    continue;
                message.To.Add(new MailAddress(objSend.Split(';')[i]));
            }
            // the email you want to send email to
            message.Subject = "逗果科技管理中心";
            message.IsBodyHtml = true;
            message.BodyEncoding = System.Text.Encoding.UTF8;
            message.Body = InnerText + "<div style=' height: 280px; overflow: scroll'>" + DongDong.Common.Misc.GetPageHTML("http://www.zfdwz.com/Crad.html") + "</div>";
            message.Priority = MailPriority.High;

            SmtpClient client = new SmtpClient("smtp.exmail.qq.com", 25); // 587;//Gmail使用的端口

            client.Credentials = new System.Net.NetworkCredential("server@dooguo.com", "yxt5211314"); // Your user name & password
            //client.EnableSsl = true; //经过ssl加密  一定要用它
            object userState = message;
            try
            {

                client.Send(message);

            }
            catch
            {
                return;
            }

        }
    }
}